<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Menu extends Model
{
    use HasFactory;

    //    可批量赋值的字段
    protected $fillable = ['name','file','path','pid','icon','sort'];

    /**
     * 菜单的子菜单
     */
    public function children()
    {
        return $this->hasMany(Menu::class,'pid','id');
    }
}
